/*
 * hostjoin.cpp
 *
 *  Created on: 2011-10-21
 *  Author    : gelif(admin@gelif.net)
 */

#include "hostjoin.h"
//----------------------------------------------------------------------------
// HostJoinDialog
//----------------------------------------------------------------------------

BEGIN_EVENT_TABLE(HostJoinDialog, wxDialog)


EVT_CLOSE(HostJoinDialog::onClose)
EVT_BUTTON(ID_BUTTONCANCEL, HostJoinDialog::onCancelClick)
EVT_BUTTON(ID_BUTTONGOFORIT, HostJoinDialog::onSubmitClick)
END_EVENT_TABLE()
////Event Table End

HostJoinDialog::HostJoinDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position,
        const wxSize& size, long style)
        : wxDialog(parent, id, title, position, size, style)
{
    createGUIControls();
}

HostJoinDialog::~HostJoinDialog()
{
}

void HostJoinDialog::createGUIControls()
{
    WxPanel1 = new wxPanel(this, ID_WXPANEL1, wxPoint(0, 0), wxSize(297, 131));
    WxPanel1->SetBackgroundColour(wxColour(244, 244, 244));

    editName = new wxTextCtrl(WxPanel1, ID_EDITNAME, wxT(""), wxPoint(114, 5), wxSize(180, 25), 0,
            wxDefaultValidator, wxT("editName"));
    editName->SetMaxLength(20);

    wxStaticText3 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT3, wxT("Name"), wxPoint(73, 9), wxDefaultSize, 0,
            wxT("WxStaticText3"));

    editAddress = new wxTextCtrl(WxPanel1, ID_EDITADDRESS, wxT("localhost"), wxPoint(114, 35), wxSize(180, 25), 0,
            wxDefaultValidator, wxT("editAddress"));

    wxStaticText2 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT2, wxT("IP Address"), wxPoint(5, 39), wxDefaultSize,
            0, wxT("WxStaticText5"));

    editPort = new wxTextCtrl(WxPanel1, ID_EDITPORT, wxT("1777"), wxPoint(114, 65), wxSize(56, 25), 0,
            wxDefaultValidator, wxT("editPort"));
    editPort->SetMaxLength(5);

    wxStaticText1 = new wxStaticText(WxPanel1, ID_WXSTATICTEXT1, wxT("TCP/IP Port"), wxPoint(35, 69), wxDefaultSize, 0,
            wxT("WxStaticText6"));

    buttonSubmit = new wxButton(WxPanel1, ID_BUTTONGOFORIT, wxT("Submit"), wxPoint(217, 102), wxSize(79, 27), 0,
            wxDefaultValidator, wxT("buttonGoForIt"));

    buttonCancel = new wxButton(WxPanel1, ID_BUTTONCANCEL, wxT("Cancel"), wxPoint(136, 102), wxSize(78, 27), 0,
            wxDefaultValidator, wxT("buttonCancel"));

    SetTitle(wxT("Network Setup"));
    SetIcon(wxNullIcon);
    SetSize(8, 8, 305, 159);
    Center();
}

void HostJoinDialog::onClose(wxCloseEvent& WXUNUSED(event))
{
    Destroy();
}

/*
 * onSubmitClick
 */
void HostJoinDialog::onSubmitClick(wxCommandEvent& WXUNUSED(event))
{
    this->SetReturnCode(1);
    this->Hide();
}

/*
 * onCancelClick
 */
void HostJoinDialog::onCancelClick(wxCommandEvent& WXUNUSED(event))
{
    this->SetReturnCode(0);
    this->Hide();
}
